/* file name  : SignalingMessage.java
 * created    : Sat 24 Sep 2005 02:49:09 PM EDT
 * authors    : Saikat Guha <saikat@cs.cornell.edu>
 * copyright  : GNU Lesser General Public License version 2.1 or later
 * 
 * Copyright (C) 2005 Saikat Guha <saikat@cs.cornell.edu>
 * 
 * This library is free software; you can redistribute it and/or modify it under the terms
 * of the GNU Lesser General Public License as published by the Free Software Foundation;
 * either version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 *  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License along with this
 * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307 USA
 * 
 */
package net.nutss;

import java.net.URI;

/**
 * Message generated by a SignalingContext for signaling network
 * specific communications.
 *
 * @author Saikat Guha
 * @version %I%, %G%
 */
public interface SignalingMessage {

    /**
     * Retrieves the sender of the message
     * @return the source of the message
     */
    URI getSource();

    /**
     * Retrieves the recipient of message
     * @return the destination of the message
     */
    URI getDestination();

    /**
     * Whether the message represents a signaling error.
     * @return true if message is a signaling error
     */
    boolean isError();

    /**
     * Whether the message has user data
     * @return true if message has a payload
     */
    boolean hasPayload();

    /**
     * returns the message payload
     * @return the payload
     */
    Object getPayload();

    /**
     * Must return the same hashCode for all messages that are part of the same end-to-end signaling session
     * @return hashcode of message
     */
    int hashCode();

    /**
     * Must return true for messages that are part of the same end-to-end signaling session
     * @param o message to check equality with
     * @return true if both messages are path of the same signaling session
     */
    boolean equals(Object o);
}
